Skip to content

[Pygments] Cleanup metaclass workarounds for mypy<1.1#15607

Merged
srittau merged 2 commits intopython:mainfrom
brianschubert:stubs-pygments-metaclass-workarounds
Apr 5, 2026
Merged

[Pygments] Cleanup metaclass workarounds for mypy<1.1#15607
srittau merged 2 commits intopython:mainfrom
brianschubert:stubs-pygments-metaclass-workarounds

Conversation

@brianschubert
Copy link
Copy Markdown
Collaborator

These were workarounds for mypy deficiencies that have since been fixed. See #9803

Also change the type of Style.alias from list[str] to Sequence[str]

@github-actions

This comment has been minimized.

@brianschubert
Copy link
Copy Markdown
Collaborator Author

cc @Akuli for being involved with the previous iterations and for porcupine

@brianschubert brianschubert force-pushed the stubs-pygments-metaclass-workarounds branch 2 times, most recently from 64d15ca to b169297 Compare April 5, 2026 00:41
@github-actions

This comment has been minimized.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 5, 2026

Diff from mypy_primer, showing the effect of this PR on open source code:

porcupine (https://github.com/Akuli/porcupine)
+ porcupine/plugins/pastebin.py:193: error: Incompatible return value type (got "str | None", expected "str")  [return-value]
+ porcupine/plugins/pastebin.py:193: error: "LexerMeta" has no attribute "aliases"  [attr-defined]

rich (https://github.com/Textualize/rich)
- rich/syntax.py:414: error: "Lexer" has no attribute "aliases"  [attr-defined]
- rich/syntax.py:415: error: "Lexer" has no attribute "aliases"  [attr-defined]
- rich/syntax.py:417: error: "Lexer" has no attribute "name"  [attr-defined]
- rich/traceback.py:763: error: "Lexer" has no attribute "name"  [attr-defined]

@srittau srittau merged commit e8d2bc6 into python:main Apr 5, 2026
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants